import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Random;
import java.util.Scanner;

class Man {
    private String name;
    int age;

    public String getName() {
        return name;
    }

    public Man(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void identify1 (String name, int age) {
        name = name;
        age = age;
    }

    public void identify2 (String name, int age) {
        this.name = name;
        this.age = age;
    }

    public static void main(String[] args) {
        Man matty = new Man("lyh",19);
        matty.identify1("Lyh", 20);
        System.out.println("name:" + matty.name + " age:" + matty.age);
        matty.identify2("Lyh", 20);
        System.out.println("name:" + matty.name + " age:" + matty.age);
    }
}


public class TestDemo {
    int age = 20;

    public void test () {
        System.out.println("普通成员方法");
    }

    public static void test2 () {
        TestDemo t = new TestDemo();
        t.test();
        t.age = 10;
    }

    public static void main21(String[] args) {
        int[] arr = {12,34,54,56,2,3,9};
        System.out.print("请输入数字的和：");
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
//        Arrays.sort(arr);
        System.out.println(Arrays.toString(arr));
        int sum = 0;

        for (int i = 0; i < arr.length; i++) {
            boolean flg = false;
            for (int j = i + 1; j < arr.length; j++) {
                sum = arr[i] + arr[j];
                if (sum == n) {
//                    System.out.println("两个数的下标分别为 " + i + " 和 "+ j);
                    System.out.println("[ " + i + ", " + j + " ]");
                    flg = true;
                    break;
                }
            }
            if (flg) {
                break;
            }
        }
    }

    public static void main20(String[] args) {
        int[][] arr = new int[3][];
        arr[0] = new int[1];
        arr[1] = new int[2];
        arr[2] = new int[3];
        System.out.println(Arrays.deepToString(arr));
    }

    public static void main19(String[] args) {
        int[][] arr = {{123,356,5768},{234,4567,435}};
        System.out.println(arr.length + " " +arr[1].length);
    }

    public static void main18(String[] args) {
        int[] arr = {1,4,6,4,2,7,4,32,7,62,3,34};
        Arrays.sort(arr);
        System.out.println("arr = " + Arrays.toString(arr));
        System.out.println("32 index = " + Arrays.binarySearch(arr,32));
    }

    public static void main17(String[] args) {
        int sum = 0;
        int[] arr = {1,2,3,4,5,6};
        for (int x : arr) {
            sum += x;
        }
        System.out.println("(float)sum = " + (float)sum);
        System.out.println("(float)arr.length = " + (float)arr.length);
        System.out.println((float)sum/arr.length);
    }

//    public static void fun(int[] arr) {
//        arr = new int[]{6,7,8,9};
//    }
    public static void main16(String[] args) {
        int[] arr = {1,2,3,4,5};
//        fun(arr);
        System.out.println(Arrays.toString(arr));
    }

    public static void main15(String[] args) {
        int[] arr1 = {122, 233, 344, 455, 566};
        int[] arr2 = {1,2,3};
        arr2 = arr1;
        System.out.println(Arrays.toString(arr2));
    }

    public static void main14(String[] args) {
        int[] arr = new int[] {12,3,4,56,567};
        System.out.println(Arrays.toString(arr));
    }

    public static void main13(String[] args) {
        int[] arr =  {3,4,5,6,5,4,3};
        int sum = 0;
        for (int i = 0; i < 7; i++) {
            sum ^= arr[i];
        }
        System.out.println("只出现一次的数字是："  + sum);
    }

//    public static int add (int a, int b) {
//        return a + b;
//    }
//
//    public static double add (double a, double b) {
//        return a + b;
//    }

    public static void main12(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int i = 0, j = 0;
        for (i = 0; i < n ; i++) {
            for (j = 0; j < n; j++) {
                if ((i == j) || (i + j + 1 == n) ) {
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }
    }

    public static void main11(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("请输入要计算的数字：");
        int n = scan.nextInt();
        int c = 0;
        int tmp = n;
        while (tmp != 0) {
            if ((tmp & 1) == 1) {
                c++;
            }
            tmp >>>= 1;
        }
        System.out.println(n + "的二进制1的个数为" + c + "个");
    }

    public static void main10(String[] args) {
        for (int i = 0; i <= 100; i++) {
             if (prime(i)) {
                 System.out.println(i);
             }
        }
    }

    public static boolean prime(int n) {
        int c = 2;
        for(;c <= Math.sqrt(n); c++) {
            if (n % c == 0) {
                return false;
            }
        }
        return true;
    }

    public static void main9(String[] args) {
        Scanner scan = new Scanner(System.in);
        Random ran = new Random();
        int n = 0;
        int num = ran.nextInt(101);
        int chance = 5;
        System.out.println("num = " + num);

        while(chance != 0) {
            System.out.print("请输入您猜测的数字：");
            n = scan.nextInt();
            if (n > num) {
                System.out.println("猜大了！");
                chance--;
            } else if (n < num) {
                System.out.println("猜小了！");
                chance--;
            } else {
                System.out.println("恭喜你猜对了！");
               break;
            }
        }

    }

    public static void main8(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        for(int i = 1; i <= n ; i++) {
            for(int j = 1; j <= i ; j++) {
                if (j != i) {
                    System.out.print(j + "*" + i + "=" + j * i + " ");
                } else {
                    System.out.println(j + "*" + i + "=" + j * i);
                }
            }

        }
    }

    public static void main7(String[] args) {
        int odd = 0;
        int even = 0;
        int i = 0;
        while(i <= 100) {
            if(i % 2 == 0){
                even +=i;
            } else {
                odd += i;
            }
            i++;
        }
        System.out.println("odd = " + odd);
        System.out.println("even = " + even);
    }

    public static void main6(String[] args) {
        Scanner scan = new Scanner(System.in);
//        int a = scan.nextInt();
//        while(scan.hasNextInt())
//        {
//            int a = scan.nextInt();
//            if (a > 0)
//                System.out.println(a);
//        }

        int a = scan.nextInt();
        System.out.println(a);
        int b = scan.nextInt();
        System.out.println(b);

    }

    public static void main5(String[] args) {
        System.out.println((3 < 2) && (1 / 0 == 0));

    }

    public static void main4(String[] args) {
        int a = 3;
        int b = 2;
        double s = a / b;
        System.out.println(s);
    }

    public static void main3(String[] args) {
        System.out.println(10%3);
        System.out.println(-10%3);
        System.out.println(10%-3);
        System.out.println(-10%-3);
    }

    public static void main2(String[] args) {
        System.out.println(5/2);
        System.out.println((float)5/2);
        System.out.println((5/(float)2));
        System.out.println((float)(5/2));
    }
}
